<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html:html>
<head>
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<title>บันทึกใบขอเบิกใช้สินค้า, วัตถุดิบ (BCStkIssue2, BCStkIssueSub2)</title>
	<script type='text/javascript' src='/ittl/dwr/interface/BCProjectService.js'></script>  
  <script type='text/javascript' src='/ittl/dwr/interface/ItemLocationService.js'></script>
  <script type='text/javascript' src='/ittl/dwr/engine.js'></script>
  <script type='text/javascript' src='/ittl/dwr/util.js'></script>
  
  

<!--  ส่วนที่ 2 -->
<script language="JavaScript">
var inputNo;
var itemName = "";
function getData(var1,x) {
	inputNo = x;
	//BCItemService.getData( var1, loadinfo );
	ItemLocationService.getData( var1, loadinfo );
	//alert("bcitem");  
}

<!--  ส่วนที่ 3 -->
function loadinfo(data)
{
	
	itemName = data.name1;

	switch(inputNo) {
	case 1:dwr.util.setValue("itemName1", itemName);break;
	case 2:dwr.util.setValue("itemName2", itemName);break;
	case 3:dwr.util.setValue("itemName3", itemName);break;
	case 4:dwr.util.setValue("itemName4", itemName);break;
	case 5:dwr.util.setValue("itemName5", itemName);break;
	}	     
}
</script>
<!--  ส่วนที่ 2 -->
<script language="JavaScript">

function getProject() {
	
	BCProjectService.getProject( form1.txtProject.value, loadinfoProject );
	alert("bcproject");  
}

<!--  ส่วนที่ 3 -->
function loadinfoProject(project)
{	
	dwr.util.setValue("txtProject", project.name);		     
}
</script>	
</head>
<body>

	<div >
	
    <form action="" name="form1">
    	
	<div id="userPw">
	<fieldset>
		<legend><b>ข้อมูลใบขอเบิกใช้สินค้า, วัตถุดิบ</b></legend>
		<table border="0">
			<tr>
				<td><label>เลขที่เอกสาร :</label></td>
				<td>
					<input type="text" name="docNo"> </td>
				<td> </td>
			</tr>
			<tr>
				<td><label>เลขที่คำสั่งซื้อ :</label></td>
				<td><input type="text" name="orderNo"></td>
				<td></td>
			</tr>			
			
 			<tr>
 				<td><label>แผนก :</label></td>
 				<td><select name="departCode">
 						<option value="000">000	Head office</option>						
						<option value="000">001	Account Department</option>
						<option value="002">002	Sales Department</option>
 					</select></td>
 				<td><label>*</label></td>		
 			</tr>				
 			<tr>
 				<td><label>เลขงบ(โครงการ)</label></td>
 				<td><input type="text" name="txtProject" onchange="getProject()"></td>
 				<td><label>*</label></td>	
 			</tr>
 			<tr>
 				<td><label>ประเภทการเบิก</label></td>
 				<td><input type="text" name="issueType"></td>
 				<td><label>*</label></td>	
 			</tr>
 			<tr>
 				<td><label>ผู้เบิก</label></td>
 				<td><input type="text" name="personCode"></td>
 				<td><label>*</label></td>	
 			</tr>
 			<tr>
 				<td><label>หมายเหตุ</label></td>
 				<td><input type="text" name="myDescription"></td>
 				<td><label>*</label></td>	
 			</tr> 			 			 				 							
		</table>
     </fieldset><br />
     <fieldset>
     	<legend><b>รายการสินค้า, วัตถุดิบ</b></legend>
		<table border="0">
			<tr>
				<td><label>รหัสสินค้า</label></td>
				<td><label>ชื่อรายการ</label></td>
				<td><label>คลัง</label></td>
				<td><label>ที่เก็บ</label></td>
				<td><label>หน่วยนับ</label></td>
				<td><label>จำนวน</label></td>				
			</tr>
			<tr>				
				<td><input name="itemCode1" type="text" size="10" maxlength="20" onchange="getData(form1.itemCode1.value,1)" /></td>
				<td><input name="itemName1" type="text" size="50" maxlength="200" /></td>
				<td><select name="whCode1" >
						<option>10:TTL - 1</option>
						<option>20:TTL - 2</option>
					</select></td>
				<td><select name="shelfCode1">
						<option>10:Central store 1</option>
						<option>11:Raw material store  1</option>
						<option>12:Chemical PD store  1</option>
						<option>13:Yarn store Raw material 1</option>
						<option>14:PD store 1</option>
						<option>15:YD store  1</option>
						<option>16:Chemical YD store  1</option>
						<option>17:Chemical FF store  1</option>
						<option>18:Yarn store 1</option>
						<option>20:Central store 2</option>
						<option>21:Raw material store  2</option>
						<option>22:Yarn store 2</option>
						<option>51:PD Grey Cloth</option>
						<option>52:YD Grey Cloth</option>
						<option>99:Head Office</option>						
					</select></td>
				<td><select name="unitCode1">
						<option>001:Unit</option>
					</select> </td>
				<td><input name="qty1" 		type="text" size="5" maxlength="10" /></td>
			</tr>
			<tr>				
				<td><input name="itemCode2" type="text" size="10" maxlength="20" onchange="getData(form1.itemCode2.value,2)" /></td>
				<td><input name="itemName2" type="text" size="50" maxlength="200" /></td>
				<td><select name="whCode2">
						<option>10:TTL - 1</option>
						<option>20:TTL - 2</option>
					</select></td>
				<td><select name="shelfCode2">
						<option>10:Central store 1</option>
						<option>11:Raw material store  1</option>
						<option>12:Chemical PD store  1</option>
						<option>13:Yarn store Raw material 1</option>
						<option>14:PD store 1</option>
						<option>15:YD store  1</option>
						<option>16:Chemical YD store  1</option>
						<option>17:Chemical FF store  1</option>
						<option>18:Yarn store 1</option>
						<option>20:Central store 2</option>
						<option>21:Raw material store  2</option>
						<option>22:Yarn store 2</option>
						<option>51:PD Grey Cloth</option>
						<option>52:YD Grey Cloth</option>
						<option>99:Head Office</option>						
					</select></td>
				<td><select name="unitCode2">
						<option>001:Unit</option>
					</select> </td>
				<td><input name="qty2" 		type="text" size="5" maxlength="10" /></td>
			</tr>
			<tr>				
				<td><input name="itemCode3" type="text" size="10" maxlength="20" onchange="getData(form1.itemCode3.value,3)" /></td>
				<td><input name="itemName3" type="text" size="50" maxlength="200" /></td>
				<td><select name="whCode3">
						<option>10:TTL - 1</option>
						<option>20:TTL - 2</option>
					</select></td>
				<td><select name="shelfCode3">
						<option>10:Central store 1</option>
						<option>11:Raw material store  1</option>
						<option>12:Chemical PD store  1</option>
						<option>13:Yarn store Raw material 1</option>
						<option>14:PD store 1</option>
						<option>15:YD store  1</option>
						<option>16:Chemical YD store  1</option>
						<option>17:Chemical FF store  1</option>
						<option>18:Yarn store 1</option>
						<option>20:Central store 2</option>
						<option>21:Raw material store  2</option>
						<option>22:Yarn store 2</option>
						<option>51:PD Grey Cloth</option>
						<option>52:YD Grey Cloth</option>
						<option>99:Head Office</option>						
					</select></td>
				<td><select name="unitCode3">
						<option>001:Unit</option>
					</select> </td>
				<td><input name="qty3" 		type="text" size="5" maxlength="10" /></td>
			</tr>
			<tr>				
				<td><input name="itemCode4" type="text" size="10" maxlength="20" onchange="getData(form1.itemCode4.value,4)" /></td>
				<td><input name="itemName4" type="text" size="50" maxlength="200" /></td>
				<td><select name="whCode4">
						<option>10:TTL - 1</option>
						<option>20:TTL - 2</option>
					</select></td>
				<td><select name="shelfCode4">
						<option>10:Central store 1</option>
						<option>11:Raw material store  1</option>
						<option>12:Chemical PD store  1</option>
						<option>13:Yarn store Raw material 1</option>
						<option>14:PD store 1</option>
						<option>15:YD store  1</option>
						<option>16:Chemical YD store  1</option>
						<option>17:Chemical FF store  1</option>
						<option>18:Yarn store 1</option>
						<option>20:Central store 2</option>
						<option>21:Raw material store  2</option>
						<option>22:Yarn store 2</option>
						<option>51:PD Grey Cloth</option>
						<option>52:YD Grey Cloth</option>
						<option>99:Head Office</option>						
					</select></td>
				<td><select name="unitCode4">
						<option>001:Unit</option>
					</select> </td>
				<td><input name="qty4" 		type="text" size="5" maxlength="10" /></td>
			</tr>
			<tr>				
				<td><input name="itemCode5" type="text" size="10" maxlength="20" onchange="getData(form1.itemCode5.value,5)" /></td>
				<td><input name="itemName5" type="text" size="50" maxlength="200" /></td>
				<td><select name="whCode5">
						<option>10:TTL - 1</option>
						<option>20:TTL - 2</option>
					</select></td>
				<td><select name="shelfCode5">
						<option>10:Central store 1</option>
						<option>11:Raw material store  1</option>
						<option>12:Chemical PD store  1</option>
						<option>13:Yarn store Raw material 1</option>
						<option>14:PD store 1</option>
						<option>15:YD store  1</option>
						<option>16:Chemical YD store  1</option>
						<option>17:Chemical FF store  1</option>
						<option>18:Yarn store 1</option>
						<option>20:Central store 2</option>
						<option>21:Raw material store  2</option>
						<option>22:Yarn store 2</option>
						<option>51:PD Grey Cloth</option>
						<option>52:YD Grey Cloth</option>
						<option>99:Head Office</option>						
					</select></td>
				<td><select name="unitCode5">
						<option>001:Unit</option>
					</select> </td>
				<td><input name="qty5" 		type="text" size="5" maxlength="10" /></td>
			</tr>
		</table>     	
     </fieldset>
 	</div>    	    	    	
    </form>
    </div>
</body>
</html:html>
